<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/Site.Master" Inherits="System.Web.Mvc.ViewPage<GridPayload>" %>
<%@ Import Namespace="ActivateYourGlutes.Payloads.Body"%>

<asp:Content ID="Content1" ContentPlaceHolderID="TitleContent" runat="server">
	Your Measurements
</asp:Content>

<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
    <div id="subheader">
        <h2>Your Measurements</h2>        
        <div>
            <%= Html.ActionLink("New Measurement", MVC.Body.Create()) %>
            <%= Html.ActionLink("View as Chart", MVC.Body.Index()) %>
        </div>
    </div>
    <div>
        <table id="list" class="scroll" cellpadding="0" cellspacing="0"></table>
        <div id="pager" class="scroll" style="text-align:center;"></div>
        <script type="text/javascript">
           function deleteRow()
           {
               $("#list").delRowData(1);
           }
        
            jQuery(document).ready(function() {
                jQuery("#list").jqGrid({
                    url: '<%= Url.Action(MVC.Body.GridData()) %>',
                    datatype: 'json',
                    mtype: 'GET',
                    colNames: [ <%= ViewData.Model.ColumnHeaders %> ],
                    colModel: [
                    <%= ViewData.Model.ColumnModel %>
                  ],
                  loadComplete: function(){
                        var ids = jQuery("#list").getDataIDs();
		                for(var i=0;i<ids.length;i++){
			                var cl = ids[i];
			                var be = '<a href="<%= Url.Action(MVC.Body.Edit()) %>/' + cl + '">Edit</a>'; 
			                var success = jQuery("#list").setRowData(ids[i],{Actions:be});
		                }	
	                },
                  editurl: "GridSave",
                  autowidth: true,
                    //width:640
                    height: 300,
                    pager: jQuery('#pager'),
                    rowNum: 15,
                    rowList: [5, 10, 20, 50],
                    sortname: 'Id',
                    sortorder: "desc",
                    viewrecords: true,
                    imgpath: '../../Content/Themes/Cupertino/Images',
                    //caption: 'My first grid'
                }).navGrid(pager, { edit: false, add: false, del: true, search: false }, {}, {}, {url: "<%= Url.Action(MVC.Body.DeleteBody()) %>"});
            }); 
        </script>
    </div>
    <div id="bottomoptions"><%= Html.ActionLink("Export to XML", "ExportToXml") %></div>
</asp:Content>
